
const {ccclass, property} = cc._decorator;

@ccclass
export default class Grid extends cc.Component {

    @property(cc.Prefab)
    GridBoarder: cc.Prefab = null;

     onLoad () {
        var size=cc.view.getVisibleSize();
        var rows=Math.ceil(size.height/50)
        var cols=Math.ceil(size.width/50);
        for(var i=0;i<rows;i++)
        {
            for(var j=0;j<cols;j++)
            {
                var grid=cc.instantiate(this.GridBoarder);
                grid.x=j*50-size.width*0.5+25
                grid.y=i*50-size.height*0.5+25
                this.node.addChild(grid)
            }
        }
     }
}
